home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / bin / spray < prev    next >
Encoding:
Text File  |  1995-08-02  |  6.6 KB  |  278 lines

  1. :
  2. # spray - script to create necessary symbolic links in /usr/lib/X11
  3. #         and /usr/skunk in order to be able to run the software provided
  4. #         on the SCO Skunkware CD-ROM
  5. #
  6. # Written 09-Mar-94 by rr@sco.com
  7. #
  8. # Usage : spray <mount-point>
  9. #         Where <mount-point> is the directory on which the CD-ROM is mounted
  10. #         If mounted on /usr/skunk, no argument is necessary
  11. #
  12.  
  13. usage() {
  14.     echo "Usage: spray [mount-point]"
  15.     echo "\tWhere mount-point refers to the directory on which"
  16.     echo "\tthe CD-ROM is mounted. If no arguments are given, it"
  17.     echo "\tis assumed the CD-ROM is mounted on /usr/skunk."
  18.     exit 1
  19. }
  20.  
  21. getyn() {
  22.     ans=
  23.     while [ "$ans" = "" ]
  24.     do
  25.         read ans
  26.         [ "$ans" = "Y" ] || [ "$ans" = "y" ] && {
  27.             ans=Y
  28.             break
  29.         }
  30.         [ "$ans" = "n" ] || [ "$ans" = "N" ] && {
  31.             ans=N
  32.             break
  33.         }
  34.         ans=
  35.         echo "\nPlease answer with a Y or N \c"
  36.     done
  37. }
  38.  
  39. [ $# = 0 ] && MOUNT_PT=/usr/skunk
  40.  
  41. [ $# = 1 ] && MOUNT_PT=$1
  42.  
  43. [ $# -gt 1 ] && usage
  44.  
  45. #
  46. # check to see if the user has root privelege
  47. #
  48. fuid=`id`
  49. uid=`echo $fuid | awk ' { print $1 } '`
  50. [ "$uid" = "uid=0(root)" ] || {
  51.     echo "You must have root priveleges to run spray."
  52.     usage
  53.     exit 1
  54. }
  55.  
  56. #
  57. # check to make sure the cd is mounted and what we expect is there
  58. #
  59. [ -f $MOUNT_PT/pics/README ] || usage
  60. [ -d $MOUNT_PT/lib/X11/app-defaults ] || usage
  61.  
  62. APPDEFDIR=/usr/lib/X11/app-defaults
  63. SKUNKLIST="README RELEASE.NOTES \
  64.     audio bin cdmt etc games include info lib man pics \
  65.     src tls usr xc"
  66. #
  67. # set up the X11 app-defaults directory
  68. #
  69. [ -d $APPDEFDIR ] || mkdir -p $APPDEFDIR
  70. cd $APPDEFDIR
  71. for i in $MOUNT_PT/lib/X11/app-defaults/*
  72. do
  73.     [ "$i" = "$MOUNT_PT/lib/X11/app-defaults/XMcd" ] && continue
  74.     [ -r `basename $i` ] || ln -s $i .
  75. done
  76.  
  77. #
  78. # set up the Willow directory
  79. #
  80. WILLOW_DIR=lib/X11/willow
  81.  
  82. [ -d /usr/$WILLOW_DIR ] || {
  83.     [ -h /usr/$WILLOW_DIR ] || ln -s $MOUNT_PT/$WILLOW_DIR /usr/$WILLOW_DIR
  84. }
  85.  
  86. #
  87. # set up the Periodic uid file
  88. #
  89. UID_DIR=lib/X11/uid
  90. UIDFILE=$UID_DIR/periodic.uid
  91.  
  92. [ -f /usr/$UIDFILE ] || {
  93.     [ -d /usr/$UID_DIR ] || mkdir -p /usr/$UID_DIR
  94.     ln -s $MOUNT_PT/$UIDFILE /usr/$UIDFILE
  95. }
  96.  
  97. #
  98. # set up directory links in /usr/local/lib (for now)
  99. #
  100. [ -d /usr/local/lib ] || {
  101.     mkdir -p /usr/local/lib
  102. }
  103. [ -d /usr/local/lib/xboing ] || {
  104.     mkdir -p /usr/local/lib/xboing
  105. }
  106. LOCALLIBDIRS="gcc-lib povray sc-6.21 xboing/levels xc xconq mosaic lynx \
  107.     X11"
  108. LOCALLIBFILS="libg++.a"
  109. for i in $LOCALLIBDIRS
  110. do
  111.     [ -d /usr/local/lib/$i ] || ln -s $MOUNT_PT/lib/$i /usr/local/lib/$i
  112. done
  113. for i in $LOCALLIBFILS
  114. do
  115.     [ -f /usr/local/lib/$i ] || ln -s $MOUNT_PT/lib/$i /usr/local/lib/$i
  116. done
  117.  
  118. # Now setup the Fresco DLL's so you don't need to modify LD_LIBRARY_PATH
  119. cd /usr/lib
  120. for i in $MOUNT_PT/lib/*.so $MOUNT_PT/lib/*.so.1.0
  121. do
  122.     ln -s $i .
  123. done
  124.  
  125. #
  126. # Setup the Flying directory in /usr/games
  127. #
  128. FLYINGDIR=/usr/games/lib/flying-6.11/fly.dta
  129. [ -d $FLYINGDIR ] || [ -h $FLYINGDIR ] || mkdir -p $FLYINGDIR
  130. [ -d $FLYINGDIR ] && chmod 777 $FLYINGDIR
  131. touch $FLYINGDIR/logfile.txt
  132. chmod a+r $FLYINGDIR/logfile.txt
  133.  
  134. #
  135. # Setup the various scorefiles in usr/games and /usr/local
  136. #
  137.  
  138. [ -d /usr/games/lib ] || mkdir -p /usr/games/lib
  139. [ -f /usr/games/lib/spatial.sco ] || {
  140.     cp $MOUNT_PT/games/lib/spatial.sco /usr/games/lib/spatial.sco
  141.     chmod 666 /usr/games/lib/spatial.sco
  142. }
  143.  
  144. XBDIR=/usr/local/lib/xboing
  145. [ -d $XBDIR ] || mkdir -p $XBDIR
  146. [ -f $XBDIR/xboing.scores ] || {
  147.     cp $MOUNT_PT/lib/xboing/xboing.scores $XBDIR/xboing.scores
  148.     chmod 666 $XBDIR/xboing.scores
  149. }
  150.  
  151. [ -f /usr/games/lib/xtetris-scores ] || {
  152.     cp $MOUNT_PT/games/lib/xtetris-scores /usr/games/lib/xtetris-scores
  153.     chmod 666 /usr/games/lib/xtetris-scores
  154. }
  155.  
  156. [ -f /usr/games/lib/mosaic.scores ] || {
  157.     cp $MOUNT_PT/games/lib/mosaic.scores /usr/games/lib/mosaic.scores
  158.     chmod 666 /usr/games/lib/mosaic.scores
  159. }
  160.  
  161. #
  162. # Setup the Nethack directory in /usr/games
  163. #
  164. NETHACKDIR=/usr/games/lib/nethackdir
  165. HACKIT=1
  166.  
  167. [ -d $NETHACKDIR ] || {
  168.     if [ -h $NETHACKDIR ]
  169.     then
  170.         echo "It looks like $NETHACKDIR is a symlink."
  171.         echo "I will leave it up to you to configure this directory."
  172.         HACKIT=
  173.     else
  174.         mkdir -p $NETHACKDIR
  175.     fi
  176. }
  177.  
  178. [ "$HACKIT" ] && {
  179.     chmod 777 $NETHACKDIR
  180.     cd $NETHACKDIR
  181.     for i in $MOUNT_PT/games/lib/nethackdir/*
  182.     do
  183.         name=`basename $i`
  184.         [ -h $name ] || [ -f $name ] || ln -s $i .
  185.     done
  186.     ls -l perm | grep $MOUNT_PT > /dev/null && {
  187.         rm -f perm
  188.         touch perm
  189.         chmod 666 perm
  190.     }
  191.     ls -l logfile | grep $MOUNT_PT > /dev/null && {
  192.         rm -f logfile
  193.         touch logfile
  194.         chmod 666 logfile
  195.     }
  196.     ls -l record | grep $MOUNT_PT > /dev/null && {
  197.         rm -f record
  198.         touch record
  199.         chmod 666 record
  200.     }
  201.     ls -l save | grep $MOUNT_PT > /dev/null && {
  202.         rm -f save
  203.         mkdir save
  204.         chmod 777 save
  205.     }
  206. }
  207.  
  208. [ "$MOUNT_PT" = "/usr/skunk" ] || {
  209.     if [ -d /usr/skunk ]
  210.     then
  211.       for foo in $SKUNKLIST
  212.       do
  213.         if [ -d /usr/skunk/$foo ]
  214.         then
  215.         # /usr/skunk/$foo is a directory for some reason so we cd there
  216.         # and try to create symbolic links out to the mount point
  217.             cd /usr/skunk/$foo
  218.             for i in $MOUNT_PT/$foo/*
  219.             do
  220.                 [ -r `basename $i` ] || ln -s $i .
  221.             done
  222.         elif [ -h /usr/skunk/$foo ]
  223.         then
  224.         # /usr/skunk/$foo is a symbolic link to a previous mount point
  225.         # so we remove it and re-link it
  226.             rm -f /usr/skunk/$foo
  227.             ln -s $MOUNT_PT/$foo /usr/skunk/$foo
  228.         else
  229.         # /usr/skunk/$foo is neither a symbolic link or directory so
  230.         # let's just try to make it a symbolic link to the mount point
  231.             rm -f /usr/skunk/$foo
  232.             ln -s $MOUNT_PT/$foo /usr/skunk/$foo
  233.         fi
  234.       done
  235.     else
  236.         rm -f /usr/skunk
  237.         ln -s $MOUNT_PT /usr/skunk
  238.     fi
  239. }
  240.  
  241. echo "\nInitial SCO Skunkware configuration complete.\n"
  242. echo "Some SCO Skunkware files need to be copied to the hard disk"
  243. echo "in order to function properly. Others need to be setuid/setgid."
  244. echo "Would you like to perform this additional setup at this time ? <Y/N> \c"
  245.  
  246. getyn
  247.  
  248. if [ "$ans" = "Y" ] 
  249. then
  250.     /usr/skunk/bin/sprinkle -m $MOUNT_PT
  251. else
  252.     echo "\nThe additional configuration necessary for some SCO Skunkware"
  253.     echo "components can be performed later by running (as root) the command :"
  254.     echo "\n\t/usr/skunk/bin/sprinkle\n"
  255. fi
  256.  
  257. echo "\nSCO Skunkware 5 contains both the NCSA Mosaic graphical web browser"
  258. echo "and Lynx, a character mode web browser. A wealth of information"
  259. echo "about Skunkware components is available via these browsers. I have"
  260. echo "temporarily set your PATH for browser use. See the RELEASE.NOTES for"
  261. echo "instructions on how to take full advantage of these documents."
  262. echo "\nWould you like to browse the SCO Skunkware 5 CD-ROM ? <Y/N> \c"
  263.  
  264. getyn
  265.  
  266. if [ "$ans" = "Y" ] 
  267. then
  268.     echo "\nStarting the SCO Skunkware 5 prowl program."
  269.     echo "Please wait while i load the pages ...\c"
  270.     /usr/skunk/bin/prowl -s
  271. else
  272.     echo "\nThe SCO Skunkware 5 CD-ROM can be browsed at your convenience"
  273.     echo "by running the command :"
  274.     echo "\n\t/usr/skunk/bin/prowl\n"
  275. fi
  276.  
  277. exit 0
  278.